<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>南京大学职业咨询室预约平台</title>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="icon" type="image/x-icon" href="{{ url_for('static', filename='assets/i/ico_128X128.ico') }}">
    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <link rel="icon" sizes="192x192" href="{{ url_for('static', filename='assets/i/app-icon72x72@2x.png') }}">
    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="apple-touch-icon-precomposed" href="{{ url_for('static', filename='assets/i/app-icon72x72@2x.png') }}">
    <!-- Tile icon for Win8 (144x144 + tile color) -->
    <meta name="msapplication-TileImage" content="{{ url_for('static', filename='assets/i/app-icon72x72@2x.png') }}">
    <meta name="msapplication-TileColor" content="#0e90d2">

    <link rel="stylesheet" href="{{ url_for('static', filename='assets/css/amazeui.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='assets/css/app.css', v='1.4') }}">
    <script src="{{ url_for('static', filename='assets/js/jquery.min.js') }}"></script>
    <script src="{{ url_for('static', filename='assets/js/amazeui.min.js') }}"></script>
</head>

<body>
<div class="admin-header">
    <!--<div class="header-back" onclick="history.back()">返回</div>-->
    <div class="header-title">咨询师名单</div>
</div>
<div class="content">
    {% for li in lists %}
    <div class="book-item-warp">
        <div class="book-item-title">
            <div class="fl"> <strong>编号：</strong>{{li['id']}}</div>
        </div>
        <div class="book-item-line">
            <div class="fl"> <strong>教师姓名：</strong>{{ li['name'] }}</div>
        </div>
        <div class="book-item-line">
            <div class="fl"> <strong>手机号：</strong>{{li['contact']}}</div>
        </div>
        <div class="book-item-line">
            <div class="fr"> <button value="{{li['id']}}" onClick="operate_teacher(this.value)" class="am-btn-danger">设置</button></div>
        </div>
        <div class="book-item-line">
            <div class="fl"> <strong>排班表：</strong></div>
        </div>
        {% for elem in li['pbinfo'] %}
        <div class="book-item-line">
            <div class="fl"> <strong>时间：</strong>{{elem['dateseq']}}&nbsp;{{elem['timeseq']}}</div>
            {% if elem['isboot'] %}
                <div class="fr"> 已被{{elem['subname']}}预约 </div>
            {% else %}
                <div class="fr"> <button value="{{elem['pbid']}}" onClick="delete_pbinfo(this.value)" class="am-btn-danger">删除</button></div>
            {% endif %}
        </div>
        {% endfor %}
        {% if li['href'] %}
        <div class="book-item-line">
            <div class="fl"> <strong>不可预约时段：</strong>{{li['href']}}</div>
        </div>
        {% endif %}
    </div>
    {% endfor %}

    <div class="am-cf">
        <button type="text" id="back_" value="返回" onclick="javascript:window.location.href='./admin_center';" class="am-btn am-btn-default">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
    </div>

    <form name="njusub">
        {{ form.csrf_token }}
    </form>
</div>

<script type="text/javascript">
    function operate_teacher(val)
    {
        document.njusub.action="/admin_set_teacher_page?val="+val;
        document.njusub.method="post";
        document.njusub.submit();
    }

    function delete_pbinfo(val)
    {
        conf = window.confirm("确定删除咨询师排班？");
        if (conf) {
            var csrftoken = $('meta[name=csrf-token]').attr('content');$.ajaxSetup({beforeSend: function(xhr, settings) {if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {xhr.setRequestHeader("X-CSRFToken", csrftoken)} }});
            $.ajax({type: 'post',url: '/delete_teacher_pbinfo',data: {pbid: val},async: 0,success: function(data) {
                alert(data.msg);
                window.location.reload();
            },error: function() {alert('服务端异常');}});
        }
    }
</script>
</body>

</html>
